.section .text
.type print_array, @function
.globl print_array
print_array:
	pushl %ebp
	movl %esp, %ebp
	pushl %ecx
	movl 12(%ebp), %ecx
loop_print:
	# calculate the array's index
	pushl %edi
	movl 12(%ebp), %edi
	subl %ecx, %edi
	
	# get the element by index
	pushl %esi
	movl 8(%ebp), %esi
	pushl %ecx
	leal (%esi, %edi, 4), %ecx
	
	# call system call
	pushl %eax
	movl $4, %eax
	pushl %ebx
	movl $1, %ebx
	pushl %edx
	movl $1, %edx
	int $0x80

	popl %edx
	popl %ebx
	popl %eax
	popl %ecx
	popl %esi
	popl %edi
	loop loop_print

	popl %ecx
	movl %ebp, %esp
	popl %ebp
	ret
	